package control
{
	import com.google.maps.LatLng;
	import com.google.maps.MapEvent;
	import com.google.maps.PaneId;
	import com.google.maps.interfaces.IMap;
	import com.google.maps.interfaces.IPane;
	import com.google.maps.overlays.OverlayBase;
	
	import flash.display.Shape;
	
	import mx.controls.Alert;

	/**
	 * SimpleShape class
	 */
	public class SimpleShape extends OverlayBase
	{
		protected var latlngs:Array;
		
		
		protected var cloud:Shape;
		protected var option:DrawOptions = new DrawOptions();
		
		protected var map:IMap;
		
		public function SimpleShape()
		{
			latlngs = [];
			this.addEventListener(MapEvent.OVERLAY_ADDED, onOverlayAdded);
			this.addEventListener(MapEvent.OVERLAY_REMOVED, onOverlayRemoved);
			
		}
		
		
		protected function onOverlayAdded(event:MapEvent):void
		{
			positionOverlay(false);
			
		}
		
		
		public override function getDefaultPane(map:IMap):IPane
		{
			this.map=map;
			
			
			return map.getPaneManager().getPaneById(PaneId.PANE_OVERLAYS);
		}
		
		public override function positionOverlay(zoomChanged:Boolean):void
		{
			draw();
		}
	
		
		protected function onOverlayRemoved(event:MapEvent):void
		{
			this.cloud.graphics.clear();	
		}
		
		public function clean():void
		{}
		
		public function destroy():void
		{
			cloud.graphics.clear();
			this.latlngs = [];
			this.removeEventListener(MapEvent.OVERLAY_ADDED, onOverlayAdded);
			this.removeEventListener(MapEvent.OVERLAY_REMOVED, onOverlayRemoved);
		}
		
		protected function draw():void
		{}
	}
}